<form class="form-horizontal form-validate form-modal" method="post" action="{:url('batchShipping')}">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">批量发货</h4>
            </div>
            <div class="modal-body">

                <div class="bs-example bs-example-tabs">
                    <ul id="myTab" class="nav nav-tabs">
                        <li class="active"><a href="#nloprinteorder" onclick="$('.kd_type').val(3);" data-toggle="tab">快递鸟打单</a></li>
                        <li class=""><a href="#nlogistics" onclick="$('.kd_type').val(2);" data-toggle="tab">无需物流</a></li>
                    </ul>
                    <input type="hidden" name="kd_type" class="kd_type" value="3"/>
                    <div id="myTabContent" class="tab-content">
                        <div class="tab-pane m-t fade in active" id="nloprinteorder" style="overflow:hidden;">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">快递公司</label>
                                <div class="col-sm-6 must">
                                    <select class="input-xlarge" name="kdn_shipping_id">
                                        <option value="">请选择快递</option>
                                        {$kdnpingopt|raw}
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane m-t" id="nlogistics"><p>如果该物品无需物流运送(如虚拟产品)</p></div>

                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <input type="hidden" id="order_ids"  value="" name="order_ids"/>
                <button type="submit" class="btn btn-primary" data-loading-text="保存中..." onclick="evalOrderids()" disabled>保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</form>

<script type="text/javascript">

    function evalOrderids(){
        $('#order_ids').val('');
        var sel_order = [];
        $('input[name="order_id"]').each(function () {
            if ($(this).is(':checked')) {
                sel_order.push($(this).val());
            }
        });
        if (sel_order.length < 1) {
            _alert('请勾选需要发货的订单.');
            $('.modal-dialog').find('.close').click();
        }

        $('#order_ids').val(sel_order.join(','));
    }

</script>
